import requests
import app


class DEMO():
    def __init__(self):
        self.url = app.BASE_URL + '/api/sys/login'
        self.headers = app.HEADERS

    # 登录
    def lodin(self, jsons):
        resp = requests.post(url=self.url, headers=self.headers,
                             json=jsons)
        return resp


# 添加部门
class DEMOS():
    def __init__(self):
        self.url = app.BASE_URL + '/api/company/department'
        # self.headers = app.HEADERS

    def lodins(self, clad, headers):  # 需要从headers中传入令牌

        respu = requests.post(url=self.url, headers=headers, json=clad)
        return respu

    # 查询部
    def lodins01(self, clad_id, headers):
        resp = requests.get(url=self.url + '/' + clad_id, headers=headers)

        return resp

    # 修改部门

    def lodins02(self, clad_id, headers, coder):
        resp = requests.put(url=self.url + '/' + clad_id, headers=headers, json=coder)
        return resp

    # 删除部门
    def lodins03(self, clad_id, headers):
        resp = requests.delete(url=self.url + '/' + clad_id, headers=headers)
